68A - Irrational problem - CodeForces Solution


implementation number theory *1100

Please click on ads to support us..

Python Code:

from itertools import permutations as per

p1, p2, p3, p4, a, b = map(int, input().split())

p = list(per([p1, p2, p3, p4], 4))

x = 0

for i in range(a, b + 1):
	c = 0
	
	for j in p:
		if (((i % j[0]) % j[1]) % j[2]) % j[3] == i:
			c += 1
			
	if c >= 7:
		x += 1
		
print(x)


Comments

Submit
0 Comments
More Questions

805B - 3-palindrome
805C - Find Amir
676C - Vasya and String
1042B - Vitamins
1729F - Kirei and the Linear Function
25D - Roads not only in Berland
1694A - Creep
659F - Polycarp and Hay
1040A - Palindrome Dance
372A - Counting Kangaroos is Fun
1396B - Stoned Game
16A - Flag
1056A - Determine Line
670B - Game of Robots
1418C - Mortal Kombat Tower
1382B - Sequential Nim
1272C - Yet Another Broken Keyboard
808A - Lucky Year
1245A - Good ol' Numbers Coloring
58B - Coins
1041C - Coffee Break
507A - Amr and Music
1041D - Glider
1486A - Shifting Stacks
1389B - Array Walk
71B - Progress Bar
701A - Cards
545A - Toy Cars
1538E - Funny Substrings
234A - Lefthanders and Righthanders